home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 405_01 / flexpp / makefile < prev    next >
Encoding:
Makefile  |  1993-08-28  |  6.2 KB  |  222 lines

  1. # make file for "flex" tool
  2.  
  3. # @(#) $Header: /usr/fsys/odin/a/vern/flex/RCS/Makefile,v 2.9 90/05/26 17:28:44 vern Exp $ (LBL)
  4.  
  5. # Porting considerations:
  6. #
  7. #    For System V Unix machines, add -DUSG to CFLAGS (if it's not
  8. #         automatically defined)
  9. #    For Vax/VMS, add "-DVMS -DUSG" to CFLAGS.
  10. #    For MS-DOS, add "-DMS_DOS -DUSG" to CFLAGS.  Create \tmp if not present.
  11. #      See MSDOS.notes for more info.
  12. #    For Amiga, add "-DAMIGA -DUSG" to CFLAGS.
  13. #    For SCO Unix, add "-DSCO_UNIX" to CFLAGS.
  14. #
  15. #    For C compilers which don't know about "void", add -Dvoid=int to CFLAGS.
  16. #
  17. #    If your C compiler is ANSI standard but does not include the <stdlib.h>
  18. #    header file (some installations of gcc have this problem), then add
  19. #    -DDONT_HAVE_STDLIB_H to CFLAGS.
  20. #
  21. # By default, flex will be configured to generate 8-bit scanners only
  22. # if the -8 flag is given.  If you want it to always generate 8-bit
  23. # scanners, add "-DDEFAULT_CSIZE=256" to CFLAGS.  Note that doing
  24. # so will double the size of all uncompressed scanners.
  25. # If on your system you have trouble building flex due to 8-bit
  26. # character problems, remove the -8 from FLEX_FLAGS and the
  27. # "#define FLEX_8_BIT_CHARS" from the beginning of flexdef.h.
  28.  
  29.  
  30. # the first time around use "make first_flex"
  31.  
  32.  
  33. # Installation targeting.  Files will be installed under the tree rooted
  34. # at DESTDIR.  User commands will be installed in BINDIR, library files
  35. # in LIBDIR (which will be created if necessary), auxiliary files in
  36. # AUXDIR, manual pages will be installed in MANDIR with extension MANEXT.
  37. # Raw, unformatted troff source will be installed if INSTALLMAN=man, nroff
  38. # preformatted versions will be installed if INSTALLMAN=cat.
  39. #DESTDIR =
  40. #BINDIR = /usr/local
  41. #LIBDIR = /usr/local/lib
  42. #AUXDIR = /usr/local/lib
  43. #MANDIR = /usr/man/manl
  44. DESTDIR = $(ENV_DIR)/
  45. BINDIR = tools/bin
  46. LIBDIR = tools/lib
  47. AUXDIR = tools/lib
  48. MANDIR = doc/man/man1
  49. MANEXT = 1
  50. INSTALLMAN = man
  51. .SUFFIXES : .dman
  52. .dman :
  53.     dman <$*.dman >$@
  54.     pman -t $@ >$*.ps
  55.  
  56. # MAKE = make
  57.  
  58.  
  59. SKELETON_FILE = $(DESTDIR)$(AUXDIR)/flexskel.cc
  60. HEADERSKELETON_FILE = $(DESTDIR)$(AUXDIR)/flexskel.h
  61. SKELFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_FILE)\" -DDEFAULT_SKELETONHEADER_FILE=\"$(HEADERSKELETON_FILE)\"
  62. CFLAGS = -O -g
  63. LDFLAGS = -s
  64.  
  65. COMPRESSION =
  66. FLEX_FLAGS = -ist8
  67. # which "flex" to use to generate scan.c from scan.l
  68. FLEX = flex++
  69. YACC= bison++ -y
  70. # CC = cc
  71.  
  72. AR = ar
  73. RANLIB = ranlib
  74.  
  75. FLEXOBJS = \
  76.     ccl.o \
  77.     dfa.o \
  78.     ecs.o \
  79.     gen.o \
  80.     main.o \
  81.     misc.o \
  82.     nfa.o \
  83.     parse.o \
  84.     scan.o \
  85.     sym.o \
  86.     tblcmp.o \
  87.     yylex.o
  88.  
  89. FLEX_C_SOURCES = \
  90.     ccl.c \
  91.     dfa.c \
  92.     ecs.c \
  93.     gen.c \
  94.     main.c \
  95.     misc.c \
  96.     nfa.c \
  97.     parse.c \
  98.     scan.c \
  99.     sym.c \
  100.     tblcmp.c \
  101.     yylex.c
  102.  
  103. FLEX_LIB_OBJS = \
  104.     libmain.o
  105.  
  106. FLEXLIB = flexlib.a
  107.  
  108.  
  109. all : flex++ $(FLEXLIB)
  110.  
  111. flex++ : $(FLEXOBJS)
  112.     $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(FLEXOBJS)
  113.  
  114. first_flex:
  115.     cp initscan.c scan.c
  116.     $(MAKE) $(MFLAGS) flex++
  117.  
  118. parse.h parse.c : parse.y 
  119.     $(YACC) -d parse.y 
  120.     @sed '/extern char.*malloc/d' <y.tab.c >parse.c 
  121.     @rm -f y.tab.c
  122.     @mv y.tab.h parse.h
  123.  
  124. scan.c : scan.l
  125.     $(FLEX) $(FLEX_FLAGS) $(COMPRESSION) scan.l >scan.c
  126.  
  127. scan.o : scan.c parse.h flexdef.h
  128.  
  129. main.o : main.c flexdef.h
  130.     $(CC) $(CFLAGS) -c $(SKELFLAGS) main.c
  131.  
  132. ccl.o : ccl.c flexdef.h
  133. dfa.o : dfa.c flexdef.h
  134. ecs.o : ecs.c flexdef.h
  135. gen.o : gen.c flexdef.h
  136. misc.o : misc.c flexdef.h
  137. nfa.o : nfa.c flexdef.h
  138. parse.o : parse.c flexdef.h
  139. sym.o : sym.c flexdef.h
  140. tblcmp.o : tblcmp.c flexdef.h
  141. yylex.o : yylex.c flexdef.h
  142.  
  143. flex.man : flex.1
  144.     nroff -man flex.1 >flex.man
  145. flex++.man : flex++.1
  146.     nroff -man flex++.1 >flex++.man
  147. flexdoc.man : flexdoc.1
  148.     nroff -man flexdoc.1 >flexdoc.man
  149.  
  150. $(FLEXLIB) : $(FLEX_LIB_OBJS)
  151.     $(AR) cru $(FLEXLIB) $(FLEX_LIB_OBJS)
  152.  
  153. lint : $(FLEX_C_SOURCES)
  154.     lint $(FLEX_C_SOURCES) > flex.lint
  155. initscan : scan.c
  156.     -mv  initscan.c initscan.c.`date '+%y%m%d%H%M'`
  157.     cp  scan.c initscan.c
  158. distrib :
  159.     mv scan.c initscan.c
  160.     chmod 444 initscan.c
  161.     $(MAKE) $(MFLAGS) clean
  162.  
  163. install: flex++ $(DESTDIR)$(LIBDIR) flexskel.cc flexskel.h install.$(INSTALLMAN) install-lib
  164.     install -s -m 755 flex++ $(DESTDIR)$(BINDIR)/flex++
  165.     install -c -m 644 flexskel.cc $(SKELETON_FILE)
  166.     install -c -m 644 flexskel.h $(HEADERSKELETON_FILE)
  167.  
  168. install-lib: $(DESTDIR)$(LIBDIR) $(FLEXLIB)
  169.     #install -c -m 644 $(FLEXLIB) $(DESTDIR)$(LIBDIR)/libfl.a
  170.     #$(RANLIB) $(DESTDIR)$(LIBDIR)/libfl.a
  171.  
  172. $(DESTDIR)$(LIBDIR):
  173.     mkdir $@
  174.  
  175. install.man: flex.1 flexdoc.1 flex++.1
  176.     install -c -m 644 flex++.1 $(DESTDIR)$(MANDIR)/flex++.$(MANEXT)
  177.     #install -c -m 644 flex.1 $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  178.     #install -c -m 644 flexdoc.1 $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT)
  179.  
  180. install.cat: flex.1 flexdoc.1 flex++.1
  181.     nroff -h -man flex++.1 > $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  182.     #nroff -h -man flex.1 > $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  183.     #nroff -h -man flexdoc.1 > $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT)
  184.     chmod 644 $(DESTDIR)$(MANDIR)/flex++.$(MANEXT)
  185.     #chmod 644 $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  186.     #chmod 644 $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT)
  187.  
  188. clean :
  189.     rm -f core errs flex++ *.o parse.c *.lint parse.h flex.man flex++.man tags lex.backtrack \
  190.         $(FLEXLIB)
  191.  
  192. tags :
  193.     ctags $(FLEX_C_SOURCES)
  194.  
  195. vms :    flex.man flex++.man flexdoc.man
  196.     $(MAKE) $(MFLAGS) distrib
  197. test : flex++
  198.     echo "diff should only be on #line directive"
  199.     -./flex++ $(FLEX_FLAGS) -S./flexskel.cc -H./flexskel.h $(COMPRESSION) scan.l | diff scan.c -
  200. bigtest :
  201.     echo "diff should only be on #line directive"
  202.     -rm -f scan.c ; $(MAKE) COMPRESSION="-C" test
  203.     echo "diff should only be on #line directive"
  204.     -rm -f scan.c ; $(MAKE) COMPRESSION="-Ce" test
  205.     echo "diff should only be on #line directive"
  206.     -rm -f scan.c ; $(MAKE) COMPRESSION="-Cm" test
  207.     echo this should fail because there is trailing context in the grammar
  208.     -rm -f scan.c ; $(MAKE) COMPRESSION="-Cfe" test
  209.     echo this should fail because there is trailing context in the grammar
  210.     -rm -f scan.c ; $(MAKE) COMPRESSION="-CFe" test
  211.     echo this should fail because there is trailing context in the grammar
  212.     -rm -f scan.c ; $(MAKE) COMPRESSION="-Cf" test
  213.     echo this should fail because there is trailing context in the grammar
  214.     -rm -f scan.c ; $(MAKE) COMPRESSION="-CF" test
  215.     echo "diff should only be on #line directive"
  216.     -rm -f scan.c ; $(MAKE)
  217. backup :
  218.     find . \( -name '*.o' -o -name '*%' -o -name 'flex++' -o -name '.tar.excludes' \) -print >.tar.excludes
  219.     tar cvfX - .tar.excludes . | compress -cv >../flex++.tar.Z
  220.  
  221.